#ifndef FILE_H
#define FILE_H

#define DEFFNC(x) JSBool x (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);

DEFFNC(openFile)
DEFFNC(writeLine)
DEFFNC(closeFile)
DEFFNC(write)
DEFFNC(readLine)
DEFFNC(read)
DEFFNC(readFile)
DEFFNC(seekline)
DEFFNC(deleteFile)
DEFFNC(flush)
DEFFNC(openFile)
DEFFNC(dir_getFiles)
DEFFNC(dir_getDirectories)
DEFFNC(dir_create)
DEFFNC(dir_delete)
DEFFNC(openDir)
DEFFNC(my_iniread)
DEFFNC(my_iniwrite)

JSBool dir_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);;
JSBool file_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
VOID file_finalize(JSContext *cx, JSObject *obj);
VOID dir_finalize(JSContext *cx, JSObject *obj);

#undef DEFFNC

const char InvalidParams[] = "Invalid parameters passed to function %s";
const char InvalidStringParam[] = "Invalid argument passed to function %s:  Parameter #%i:  %s";
const char InvalidIntParam[] = "Invalid argument passed to function %s:  Parameter #%i:  %i";

static JSFunctionSpec file_functions[] = {
	{"fileOpen",		openFile,				2},		// lord2800
	{"fopen",			openFile,				2},		// lord2800 (added back in because I like that name, I left fileOpen too)
	{"directoryOpen",	openDir,				1},		// lord2800
	{"dopen",			openDir,				1},		// lord2800
	{"iniread",			my_iniread,				4},
	{"iniwrite",		my_iniwrite,			4},
};

#endif